<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
  <style>
    #d1{
      width: 1000px;
      height: 100px;
      background-color: red;
      /*设置固定定位,脱离文档流(不占位置)*/
      position: fixed;
      /*坐标相对于窗口做偏移*/
      top: 0;
    }
    body{
      padding-top: 100px; /*解决图片被覆盖的问题
      */
    }
    #d2{
      width: 50px;
      height: 200px;
      background-color: blue;
      position: fixed;
      right: 30px;
      bottom: 100px;
    }
  </style>
</head>
<body>
<div id="d1"></div>
<div id="d2"></div>
<img src="../b.jpg" alt="">
<img src="../b.jpg" alt="">
<img src="../b.jpg" alt="">
<img src="../b.jpg" alt="">
<img src="../b.jpg" alt="">
<img src="../b.jpg" alt="">
</body>
</html>